/*
 * @Date: 2023-01-22 02:17:37
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-22 07:33:16
 * @FilePath: \campus-repair-platform\server\schema\manage\repairer_type.js
 */
/**
 * list_schema  获取年级列表
 * query_schema   根据name模糊查询年级
 * add_schema   添加年级
 * update_schema  修改年级信息
 */

const joi = require("joi")
const { id, page, pagesize } = require("../common")

const name = joi
  .string()
  .min(1)
  .max(8)
  .error(new Error("年级名称格式有误"))

exports.list_schema = {
  query: {
    page,
    pagesize: joi
      .number()
      .min(1)
      .max(50)
      .error(new Error("数据条数格式有误")),
    name
  },
}

exports.add_schema = {
  body: {
    name: name.required()
  },
}

exports.update_schema = {
  body: {
    id: id.required(),
    name
  },
}
